/**
* @file OLED.h
* @brief OLED SPI驱动库函数
*/

#ifndef __OLED_H__
#define __OLED_H__

#include "stm32f10x.h"

extern char OLED_zfc[];        // 字符转化为字符串储存于此数组

#define Font_Size_F6X8 1
#define Font_Size_F8x16 0

#define OLED_SCL_CLR() GPIO_ResetBits(GPIOA, GPIO_Pin_5) // 时钟
#define OLED_SCL_SET() GPIO_SetBits(GPIOA, GPIO_Pin_5)

#define OLED_SDA_LOW() GPIO_ResetBits(GPIOA, GPIO_Pin_7) // MOSI主设备输出
#define OLED_SDA_HIGH() GPIO_SetBits(GPIOA, GPIO_Pin_7)

#define OLED_RST_OFF() GPIO_ResetBits(GPIOA, GPIO_Pin_8) // 接低电平复位
#define OLED_RST_ON() GPIO_SetBits(GPIOA, GPIO_Pin_8)

#define OLED_DC_CMD() GPIO_ResetBits(GPIOA, GPIO_Pin_9) // 模式
#define OLED_DC_DAT() GPIO_SetBits(GPIOA, GPIO_Pin_9)

void OLED_IO_Init(void);
void OLED_DMA_Init(void);
void OLED_Init(void);
void OLED_SendCmd(u8 TxData);  //发送命令

void OLED_ColorTurn(uint8_t i); //OLED反色显示
void OLED_DisplayTurn(uint8_t i); //OLED屏幕旋转180
void OLED_DisPlay_On(void);  //开启oled显示
void OLED_DisPlay_Off(void); //关闭oled显示

void OLED_Clear(uint8_t led);  //清屏--全灭

void OLED_DrawPoint(uint8_t x, uint8_t y); //画一个点
void OLED_ClearPoint(uint8_t x, uint8_t y); //清除一个点

void OLED_DrawLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2); //画一条线
void OLED_ClearLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2); //清除一条线

void OLED_DrawCircle(uint8_t x, uint8_t y, uint8_t r); //画圆
void OLED_ClearCircle(uint8_t x, uint8_t y, uint8_t r); //清除圆

void OLED_ShowNum(uint8_t x, uint8_t y, float num, uint8_t Font_Size); //显示数字

void OLED_ZF(uint8_t x, uint8_t y, uint8_t *ascii, uint8_t Font_Size);  //显示单字符
void OLED_ZFC(uint8_t x, uint8_t y, uint8_t *chr, uint8_t Font_Size); //显示字符串
void OLED_ZFC_Horizontal_center(uint8_t y, uint8_t *chr, uint8_t Font_Size); //显示字符串水平居中
void OLED_ZFC_Vorizontal_center(uint8_t x, uint8_t *chr, uint8_t Font_Size);  //显示字符串垂直居中

void OLED_ONE_HZ(uint8_t x, uint8_t y, uint8_t page, uint8_t num); //显示一个文字
void OLED_Long_HZ(uint8_t x, uint8_t y, uint8_t page, uint8_t num1, uint8_t num2); //显示一句
void OLED_Long_HZ_Horizontal_center(uint8_t y, uint8_t page, uint8_t num1, uint8_t num2); //显示一句话水平居中
void OLED_Long_HZ_Vorizontal_center(uint8_t x, uint8_t page, uint8_t num1, uint8_t num2); //显示一句话垂直居中
void OLED_ShowPicture(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t *BmpArr); //显示图片

#endif
